package Main;

class Lab {

    static double great = 20; //优的补助价格
    static double good = Math.ceil(great*0.75); //良的补助价格
    static double pass = Math.ceil(great*0.5); //及格的补助价格
    //向上取整：Math.ceil()
    private String name;
    private int room;
    private Score score; //分数列表

    public Lab(String name,int room){  //使用默认的补助价格
        //this.Buzhu = Budge;
        this.name = name;
        this.room = room;
    }

    public Lab(double buzhu,String name,int room){ //自定义补助价格
        Lab.great = buzhu;
        this.name = name;
        this.room = room;
    }

    public void setRoom(int room) { this.room = room; }
    public void setName(String name) {
        this.name = name;
    }
    public void setScore(Score score) {
        this.score = score;
    }

    public double getGreat() {
        return great;
    }
    public double getGood() {
        return good;
    }
    public double getPass() {
        return pass;
    }
    public int getRoom() {
        return room;
    }
    public String getName() {
        return name;
    }
    public Score getScore(){
        return score;
    }


}
class Score {
    //private String result;
    private int[] result = new int[18];

    public Score(String name,int[] score){
        result = score;
    }

    public int[] getResult() {
        return result;
    }
}
class Student {
    String name;
    int id;
    double money; //全部补助
    int i; //实验室数量
    Lab[] labs = new Lab[5]; //一堆实验室
    final double tax = 0.3; //一个不变的税率
    final double tax2 = 0.4;
    final double tax3 = 0.1;

    public Student(String name,int id){
        this.name = name;
        this.id = id;
    }

    //给学生添加实验室
    public void add_lab(Lab lab){
        labs[i] = lab;
        i++;
    }

    //计算全部所得钱数
    public void cal_money(){
        int[] a = new int[18];
        for (int i = 0;i< labs.length;i++){
            if (labs[i] == null){
                continue;
            }
            else {
                a = labs[i].getScore().getResult(); //分数数组  18个数字是数组
                for(int j=0;j<18;j++){
                    if(a[j]<=5){ //5分以下及格
                        money = money + Lab.pass;
                        System.out.println(j+1 +"周收入:" +money);
                    }
                    else if(a[j]>7){ //7分以上优秀
                        money = money + Lab.great;
                        System.out.println(j+1 +"周收入:" +money);
                    }
                    else{  //其余良好
                        money = money + Lab.good;
                        System.out.println(j+1 +"周收入:" +money);
                    }
                }
            }
        }
        System.out.println("总共收入" + money);
    }

    public void cal_tax() {
    }
}
class Testing {
    public static void main(String args[]){
        //实例化一堆实验室
        Lab lab1 = new Lab("大学生创新实验室",501);
        Lab lab2 = new Lab("组成原理实验室",857);
        Lab lab3 = new Lab("计算机网络实验室",757);
        Lab lab4 = new Lab("大学生创新实验室",758);

        //实例化学生
        Student stu1 = new Student("李六",20210853);
        Student stu2 = new Student("张五",20283153);

        //给学生分配实验室
        stu1.add_lab(lab1);
        stu1.add_lab(lab2);
        stu2.add_lab(lab3);
        stu2.add_lab(lab4);

        //评分
        int[] a= {5,4,5,7,9,8,10,7,5,8,9,7,9,5,7,9,8,6};//这里面是18个数，1-10之间
        int[] b= {5,10,7,5,8,8,7,9,5,7,9,8,6,5,7,9,8,6};
        int[] c= {5,6,7,9,8,8,7,9,7,7,9,8,8,10,7,5,7,9};
        int[] d= {5,10,7,5,8,8,7,9,5,7,9,8,6,10,7,5,8,9};
        Score sco1 = new Score("计算机网络实验室",a); //这个地方的name和上面lab1.2.3的名字一样，相对应就行
        Score sco2 = new Score("组成原理实验室",b);
        Score sco3 = new Score("大学生创新实验室",c);
        Score sco4 = new Score("大学生创新实验室",d);

        //评分传给每个对应实验室
        lab1.setScore(sco1);
        lab2.setScore(sco2);
        lab3.setScore(sco3);
        lab4.setScore(sco4);

        //算总收入钱数,然后算税后
        stu1.cal_money();  //总收入
        stu1.cal_tax();   //税后
        stu2.cal_money();
        stu2.cal_tax();
    }
}

